﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.IO;

namespace PSE.Deployment.SetupBase.Configuration.Actions
{
    [Serializable]
    public class InstallCertificate : ActionBase
    {
        public List<Certificate> Certificates { get; set; }

        public InstallCertificate()
        {
            Certificates = new List<Certificate>();
        }

        public override bool HasFile(string filePath)
        {
            if (string.IsNullOrEmpty(filePath) || this.Certificates == null || this.Certificates.Count == 0)
                return false;
            else
                //verificar se exist o arquivo informado esta configurado como um icone ou como um atalho
                return this.Certificates.Exists(c => (c.File != null && filePath.Equals(Path.Combine(PSE.Deployment.Util.File.RemoveRootLevel(c.File.Destination), c.File.FileName), StringComparison.CurrentCultureIgnoreCase)));
        }
    }
}
